package com.concurrent.sample.business.event.service.impl;

import com.concurrent.sample.business.event.entity.EventEntity;
import com.concurrent.sample.business.event.repo.EventRepo;
import com.concurrent.sample.business.event.service.IEventService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
@Slf4j
public class EventServiceImpl implements IEventService {

  private final EventRepo eventRepo;

  @Override
  public EventEntity insertEvent(EventEntity eventEntity) {
    return eventRepo.save(eventEntity);
  }

  @Override
  public EventEntity updateEvent(EventEntity eventEntity) {
    return eventRepo.save(eventEntity);
  }

  @Override
  public EventEntity getById(Long id) {
    return eventRepo.findById(id).orElse(null);
  }

}
